<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>药品管理仓库</title>
		<script src=" ../../js/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="../../css/bootstrap.css" type="text/css" />
		<script src="../../js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
		<style>
			* {
				margin: 0 auto;
				padding: 0;
			}

			#a {
				width: 1000px;
				height: 800px;
				background-image: url(../../img/2.jpg);
				background-size: 100% 100%;
				background-repeat: no-repeat;
				color: white;
			}

			h1 {
				color: white;
				display: inline-block;
				margin-left: 250px;
				text-align: center;
				font-weight: 500;
				letter-spacing: 50px;
			}

			table {
				height: 200px;
				display: inline-block;
				margin-top: 10px;
				margin-left: 200px;
				border: none;
			}

			th,
			td {
				text-align: center;
				width: 100px;
				height: 30px;

			}

			#b {
				display: inline-block;
				margin-left: 800px;
				width: 82px;
				height: 34px;
				color: #000000;
			}
			nav{
				margin-left: 400px;
			}
		</style>
	</head>
	<body>
		<div id="a">
			<h1>药品管理仓库</h1>
			<table>

				<tr>
					<th>序号</th>
					<th>药品名称</th>
					<th>库存数量</th>
					<th>单价</th>
					<th>备注</th>
					<th></th>
				</tr>
				<form action="/drug/delete" method="post">
					<c:forEach items="${drugs}" var="drug" varStatus="status">
						<tr>
							<td><input type="checkbox" value="${status.index+1}" name="id">${status.index+1}</td>
							<td>${drug.dname}</td>
							<td>${drug.num}</td>
							<td>${drug.sprice}</td>
							<c:choose>
								<c:when test="${drug.num<10}">
									<td>库存紧张，请尽快补货</td>
								</c:when>
								<c:when test="${drug.num>=10}">
									<td></td>
								</c:when>
							</c:choose>
							<td><a href="/drug/updateUi?id=${drug.id}" class="btn btn-default active" role="button">更新数据</a></td>
						</tr>
					</c:forEach><br>
			</table>
			<nav class="my-nav" aria-label="Page navigation">

				<ul class="pagination">
					<li>
						<a href="/drug/showUi?page=1" aria-label="Previous">
							<span aria-hidden="true">&laquo;</span>
						</a>
					</li>
					<li><a href="/drug/showUi?page=1">1</a></li>
					<li><a href="/drug/showUi?page=2">2</a></li>
					<li><a href="/drug/showUi?page=3">3</a></li>
					<li><a href="/drug/showUi?page=4">4</a></li>
					<li>
						<a href="/drug/showUi?page=4" aria-label="Next">
							<span aria-hidden="true">&raquo;</span>
						</a>
					</li>
				</ul>
			</nav>
			<input id="b" type="submit" value="删除数据" />
			</form>
			<button id="add-btn" type="button" class="btn btn-default" data-toggle="modal"
				data-target="#my-modal1">添加数据</button>
		</div>
		<div class="modal fade" id="my-modal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
								aria-hidden="true">&times;</span></button>
						<h3 class="modal-title" id="myModalLabel1">添加数据</h3>
					</div>
					<div class="modal-body">
						<form id="add-from" action="/drug/add" method="post">
							药品名称：<input type="text" name="dname" /><br>
							数量：<input type="text" name="num" /> <br>
							单价：<input type="text" name="sprice" />
							<br>
						</form>
					</div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>

						<button type="submit" form="add-from" class="btn btn-primary">添加</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
